pub mod command;
pub mod nodes;
pub mod plugins;

use mf_core::{Extension, Extensions};
// 重新导出主要的结构体和工厂
use crate::plugins::{plugin_djgc};
pub use nodes::node_definitions::{DjgcContainerNode, DjgcRowNode};

/// 单价构成节点工厂
pub struct DjgcFactory;

impl DjgcFactory {
    pub fn build() -> Vec<Extensions> {
        let mut extensions = Vec::new();
        let nodes = DjgcFactory::create_djgc_structure();
        for d in nodes {
            extensions.push(Extensions::N(d));
        }
        let mut base_schema_ext = Extension::new();
        base_schema_ext.add_plugin(plugin_djgc::new().into());
        extensions.push(Extensions::E(base_schema_ext));
        extensions
    }
    /// 创建单价构成节点结构
    pub fn create_djgc_structure() -> Vec<mf_core::node::Node> {
        let container = DjgcContainerNode::node_definition();
        let row = DjgcRowNode::node_definition();

        vec![container, row]
    }

    /// 创建单价构成容器节点
    pub fn create_container_node() -> mf_core::node::Node {
        DjgcContainerNode::node_definition()
    }

    /// 创建单价构成行节点
    pub fn create_row_node() -> mf_core::node::Node {
        DjgcRowNode::node_definition()
    }
}
